package com.jsftoolkit.gen.writer;

import java.util.LinkedHashMap;
import java.util.Set;

/**
 * Utility base class for implementations of sub interfaces of
 * {@link ClassWriter}. By extending this class, the sub-interface
 * implementations are not coupled to a particular {@link ClassWriter}
 * implementation.
 * <p>
 * All methods pass through to the wrapped {@link ClassWriter}.
 */
public abstract class ClassWriterWrapper implements ClassWriter {
	private ClassWriter writer;

	public void close() {
		writer.close();
	}

	public void endBlock() {
		writer.endBlock();
	}

	public ClassWriter indent() {
		return writer.indent();
	}

	public ClassWriter print(char c) {
		return writer.print(c);
	}

	public ClassWriter print(CharSequence s) {
		return writer.print(s);
	}

	public void printClassComment() {
		writer.printClassComment();
	}

	public void printConstant(Class<?> type, String name, CharSequence value) {
		writer.printConstant(type, name, value);
	}

	public void printDeclaration(int mods, String className, Class<?> superClass,
			Iterable<Class<?>> interfaces) {
		writer.printDeclaration(mods, className, superClass, interfaces);
	}

	public void printImports(Set<Class<?>> imports) {
		writer.printImports(imports);
	}

	public void printModifiers(int mod) {
		writer.printModifiers(mod);
	}

	public void printPackage(String _package) {
		writer.printPackage(_package);
	}

	public void printType(Class<?> c) {
		writer.printType(c);
	}

	public ClassWriter printf(String format, Object... args) {
		return writer.printf(format, args);
	}

	public ClassWriter println(CharSequence s) {
		return writer.println(s);
	}

	public void startBlock() {
		writer.startBlock();
	}

	public void startConstructor(int mods, LinkedHashMap<String, Class<?>> params,
			Class<? extends Throwable>... exceptions) {
		writer.startConstructor(mods, params, exceptions);
	}

	public void startField(int mods, Class<?> type, String name) {
		writer.startField(mods, type, name);
	}

	public void startMethod(int mods, Class<?> returnType, String name,
			LinkedHashMap<String, Class<?>> params,
			Class<? extends Throwable>... exceptions) {
		writer.startMethod(mods, returnType, name, params, exceptions);
	}

	public void printPropertyAccessors(String propertyName,
			Class<?> propertyClass) {
		writer.printPropertyAccessors(propertyName, propertyClass);
	}

	public String getFieldName(String name) {
		return writer.getFieldName(name);
	}

	public ClassWriter getWriter() {
		return writer;
	}

	public void setWriter(ClassWriter writer) {
		this.writer = writer;
	}

}
